<#import "/admin/common/home.html" as home>
<#import "/admin/common/upload.html" as upload>
<#assign css>
<link rel="stylesheet" href="/style/admin/css/webuploader.css"/>
</#assign>
<#assign js>
<script src="/plugins/webuploader/webuploader.js"></script>
<script src="/plugins/webuploader/init.upload.js"></script>
</#assign>
<@home.home pagecss=css pagejs=js><#escape x as (x)!"">
<style>
    .text-center input{display: inline-block;width: 60%;}
</style>
<div class="page-dialog-content ">
    <div class="panel-dialog">
        <form id="infoSaveForm" action="save" method="post" class="form-horizontal form-dialog-horizontal">
            <input type="hidden" name="targetId" value="${info.targetId}" />
            <input type="hidden" name="targetType" value="${info.targetType}" />
            <input type="hidden" name="type" value="${info.type}" />

            <input type="hidden" id="fileName" name="fileName" value="${info.fileName}" />
            <div class="panel-dialog-body">
                <div class="pb30 pt50 text-center">
                    <@upload.uploadFile name="fileId" fileId=(info.fileId)! fileName=(info.fileName)! />
                </div>
                <div class="text-center">
                    <button id="dialog-btn-save" type="button" onclick="save();" class="btn btn-primary">开始导入</button>&nbsp&nbsp
                    <button type="button" onclick="parent.layer.closeAll();" class="btn btn-default">关闭</button>
                </div>
                <#if annotation.tplMode() == 1>
                <p class="pt10 text-center">下载模板：<a href="tpl?type=${info.type}" class="col-3">${annotation.name()}导入标准模板</a></p>
                </#if>
                <#if annotation.tplMode() == 2>
                    <p class="pt10 text-center">下载模板：<a href="/download/resource?fileName=file/import/${info.type}.xlsx" class="col-3">${annotation.name()}导入标准模板</a></p>
                </#if>
           </div>
    </form>
</div>
</div>
<script type="text/javascript">
    $(function(){
        frm.submit("iframe", "infoSaveForm");
    });

    var save = function() {
        if ($("input[name='fileId']").val() == '') {
            x.error("请先上传文件");
            return;
        }
        #("#fileName").val($("input[name='fileIdName']").val());
        $("#infoSaveForm").submit();
    }
</script>
</#escape></@home.home>